﻿Public Class HomePageEdit
    Inherits BasePage

    ' ''' <summary>
    ' ''' 
    ' ''' </summary>
    ' ''' <remarks>
    ' ''' 0: tham chieu
    ' ''' 1: edit
    ' ''' </remarks>
    'Protected nViewMode As Integer

    'Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    '    Try
    '        If Not IsPostBack() Then
    '            nViewMode = 0
    '            Call GetContent()                
    '        End If
    '    Catch ex As Exception
    '        Server.Transfer("~/Pages/Error.aspx")
    '    End Try

    'End Sub

    'Private Sub btnFunction_Click(sender As Object, e As System.EventArgs) Handles btnEdit.Click, btnSave.Click, btnCancel.Click
    '    Dim btnSender As Button = DirectCast(sender, Button)

    '    Try
    '        Select Case btnSender.ID
    '            Case btnEdit.ID
    '                nViewMode = 1
    '                Call GetContent()
    '            Case btnSave.ID
    '                Call SaveContent()
    '                nViewMode = 0
    '                Call GetContent()
    '            Case btnCancel.ID
    '                nViewMode = 0
    '                GetContent()
    '        End Select
    '    Catch ex As Exception
    '        Server.Transfer("~/Pages/Error.aspx")
    '    End Try
    'End Sub

    'Protected Sub SaveContent()

    '    Dim xSql As String
    '    Dim dataAccess As DBAccess

    '    Try
    '        dataAccess = Me.GetDBAccess

    '        xSql = "UPDATE T_DATA"
    '        xSql = xSql & vbCrLf & "SET CONTENT = @CONTENT"
    '        xSql = xSql & vbCrLf & "WHERE T_DATA.CODE = " & CommonConstants.C_HOME_PAGE_CODE

    '        xSql = Replace(xSql, "@CONTENT", CommonMethods.ToSqlStr(Me.Editor.Text, CommonMethods.SqlDataType.DataType_String))

    '        dataAccess.ExecuteSqlString(xSql)

    '    Catch ex As Exception
    '        Throw
    '    End Try

    'End Sub

    'Protected Sub GetContent()
    '    Dim xSql As String
    '    Dim dataAccess As DBAccess
    '    Dim ds As DataSet

    '    Try
    '        dataAccess = Me.GetDBAccess

    '        xSql = "SELECT * FROM T_DATA"
    '        xSql = xSql & vbCrLf & "WHERE CODE= " & CommonConstants.C_HOME_PAGE_CODE

    '        ds = dataAccess.GetDBDataset(xSql)
    '        If ds Is Nothing OrElse ds.Tables(0).Rows.Count < 1 Then
    '            Throw New Exception("NO_DATA_FOUND")
    '        End If
    '        dataAccess.ExecuteSqlString(xSql)
    '        If nViewMode = 0 Then
    '            Me.ltContent.Text = CommonMethods.Nz(ds.Tables(0).Rows(0)("CONTENT"), "")
    '        Else
    '            Me.Editor.Text = CommonMethods.Nz(ds.Tables(0).Rows(0)("CONTENT"), "")
    '        End If
    '    Catch ex As Exception
    '        Throw
    '    End Try
    'End Sub

    'Private Sub HomePageEdit_PreInit(sender As Object, e As System.EventArgs) Handles Me.PreInit
    '    Dim master As AdminMasterPage = DirectCast(Me.Page.Master, AdminMasterPage)
    '    master.ScriptLinkAdd("ckfinder/ckfinder.js")
    '    master.ScriptLinkAdd("Scripts/ProductEdit.js")
    'End Sub
End Class